package com.ls.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ls.controller.issend.model.SendStatusModel;
import com.ls.entity.IsSend;
import com.ls.mapper.IsSendMapper;
import com.ls.service.IIsSendService;
import com.ls.utils.ResultData;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 是否发送 服务实现类
 * </p>
 *
 * @author pengyu
 * @since 2024-10-12
 */
@Service
@Slf4j
public class IsSendServiceImpl extends ServiceImpl<IsSendMapper, IsSend> implements IIsSendService {
    /**查看全部*/
    @Override
    public ResultData getIsSend() {
        return ResultData.successData(list(new LambdaQueryWrapper<IsSend>()));
    }
    /**修改发送状态*/
    @Override
    public ResultData updateSendStatus(SendStatusModel model) {
        IsSend isSend=getById(model.getSendId());
        BeanUtils.copyProperties(model,isSend);
        Boolean flag=updateById(isSend);
        if (flag){
            return ResultData.successMsg("修改成功");
        }else {
            return ResultData.failure("修改失败");
        }
    }
}
